﻿@model Model.AppUserList
@{
    ViewBag.Title = "DeliveryBox";
    Layout = "~/Views/Shared/_JQBaseLayOut.cshtml";
}

@section JQscriptSection{
    <script src="../../Scripts/viewsScript/DeliveryBox/DeliveryBoxC.js" type="text/javascript"></script>
    <script src="../../Scripts/viewsScript/Common/MyDialog.js" type="text/javascript"></script>
    <script src="../../Scripts/jqueryeasyui/locale/easyui-lang-zh_CN.js" type="text/javascript"></script>
    <script src="../../Scripts/Jquery.easy.ui.extend.js" type="text/javascript"></script>
    <script src="../../Scripts/Common.js" type="text/javascript"></script>

    <script type="text/javascript">

        $(function () {
            $('#btnExecl').hide();
            $('#selDBoxType').combobox('setValue', '0');
        });

        function GetDelieryBoxInfo() {
            $('#btnExecl').show();
            InitGrid();
        }

        function GetExcel() {
            var form = $('#query');
            var seedtype = $('#selDBoxType').combobox('getValue');
            var barCodeNumber = $.trim($("#txtNumber").attr("value"));
            if (barCodeNumber == "" || barCodeNumber < 0) {
                alert("请正确输入数量！");
                return false;
            }
            if (seedtype == "0") {
                alert("请选择要生成的箱码类型！");
                return false;
            }
            form.form('submit', {
                url: '@Url.Content("~/DeliveryBox/GetLmDeliveryBox")' + '?BarCodeNumber=' + barCodeNumber + "&seedType=" + seedtype,
                success: function (data) {
                    eval('data=' + data);
                    if (data.success) {
                        $("#txtDBBCBATCHNO").val(data.msg);
                        alert("生成成功!");
                        $('#btnExecl').show();
                        InitGrid();
                    } else {
                        $.messager.alert('错误', data.msg, 'error');
                    }
                }
            });
            }
            function ExporterExcel() {
                var form = $('#import');
                var dbbcBatchNo = $.trim($("#txtDBBCBATCHNO").attr("value"));
                var startDate = $('#StartDate').datebox('getValue');
                var endDate = $('#EndDate').datebox('getValue');
                form.form('submit', {
                    url: '@Url.Content("~/DeliveryBox/ExporterExcel")' + '?dbbcBatchNo=' + dbbcBatchNo + "&startDate=" + startDate + "&endDate=" + endDate,
                success: function (data) {
                    eval('data=' + data);
                    if (data.success) {
                        alert("导出成功!");
                    } else {
                        $.messager.alert('错误', data.msg, 'error');
                    }
                }
            });
        }
    </script>
}
<body style="background-color: ButtonFace; font-size: 17px">
    <div class="easyui-panel" title="查询条件" style="height: 130px; padding: 5px; background: #fafafa;">
        <form id="query" method="post">
            <table>
                <tr>
                    <td>
                        批次号:
                    </td>
                    <td>
                        <input id="txtDBBCBATCHNO" name="txtDBBCBATCHNO" style="width: 154px" validtype="integer['#txtDBBCBATCHNO']" />
                    </td>
                    <td>
                        生成时间:
                    </td>
                    <td>
                        <input class="easyui-datebox" id="StartDate" name="StartDate" style="width: 140px;" />
                    </td>
                    <td>
                        ~：
                    </td>
                    <td>
                        <input class="easyui-datebox" id="EndDate" name="EndDate" style="width: 140px;" validtype="compareDate['#StartDate']" />
                    </td>
                    <td></td>
                    <td>
                        <a id="btnSerach" href="#" class="easyui-linkbutton" data-options="iconCls:'icon-search'" onclick="GetDelieryBoxInfo();">查询</a>

                    </td>
                </tr>
                <tr>
                    <td>
                        生成类型:
                    </td>
                    <td>
                          <input id="selDBoxType" class="easyui-combobox" name="selDBoxType" style="width: 155px;" data-options="required:true,valueField:'FIELDVALUE',textField:'LOOKUP',url:'@Url.Action("GetDeliveryBoxType", "DeliveryBox", new { isDefault = true, defaultValue = "请选择箱码类型" })',editable:false">
                    </td>
                    <td>
                        数  量:
                    </td>
                    <td>
                        <input id="txtNumber" name="txtNumber" style="width: 154px" />
                    </td>
                    <td>
                        <a id="btnGet" href="#" class="easyui-linkbutton" data-options="iconCls:'icon-excel'" onclick="GetExcel()">生成</a>
                    </td>
                </tr>
            </table>
        </form>

    </div>

    <div>
        <table id="tab_list"></table>


    </div>
    <form id="import" method="post" enctype="multipart/form-data">
        <table>
            <tr>
                <td>
                    <a id="btnExecl" href="#" class="easyui-linkbutton" data-options="iconCls:'icon-excel'" onclick="ExporterExcel()">导出</a>
                </td>
            </tr>
        </table>
    </form>

</body>

